﻿namespace KinonekoSoftware.CodariaDB.Utils
{
    public static class Codaria
    {
        public const string ID                     = "_id";
        public const int    DatabaseInitializeSize = 4 * 1048576;
        public const int    MaxGeographyDepth      = 20;
        public const int    MaxSpeciesDepth        = 16;
        public const int    CurrentDatabaseVersion = 110;




        public const string Repository_IndexerFileName = "database.indexer.json";
        public const string Repository_MainFileName    = "database.projDB";
        public const string Repository_LogFileName     = "database.log.projDB";
        public const string Repository_BackupFileName  = "database.backup.projDB";




        public static bool HasID<T>(this ILiteCollection<T> db, string id)
        {
            return db.Exists(Query.EQ(ID, id));
        }


        public static bool HasName<T>(this ILiteCollection<T> db, string name)
        {
            return db.Exists(Query.EQ("name", name));
        }

    }
}